package bpel2rep.version.util;

import bpel2rep.version.VersionFactory;
import bpel2rep.version.VersionId;
public class VersionIdUtil {
	
	/**
	 * generate next version id
	 * @param versionid, the original version id
	 * @param isMajor, whether the change is a major change
	 * @return
	 */
	public static VersionId increaseVersion(VersionId versionid, boolean isMajor){
		int majorId;
		int minorId;
		if (isMajor) {
			majorId = versionid.getMajorID() + 1;
			minorId = versionid.getMinorID();
		} else {
			majorId = versionid.getMajorID();
			minorId = versionid.getMinorID() + 1;
		}
		VersionId vid = VersionFactory.eINSTANCE.createVersionId();
		vid.setMajorID(majorId);
		vid.setMinorID(minorId);
		return vid;
	}
}
